function y = prb (fun, x, p, q, x0)

   ## usage:  y = prb (fun, x, p, q, x0)
   ##
   ## probit transform using fun to fit cdf

   if (strcmp(fun, "gam") && any(p<=0))
      y = inf(size(x)) ;
      return ;
   endif
   p = mat2cell(p(:)', 1, ones(1, length(p))) ;
   x = (x - x0) / p{1} ;
   y = feval([fun "cdf"], x, p{2:end}) ;
   y = (1-q) * y + q ;
   y = norminv(y) ;
   # y(!isfinite(y)) = -inf ;

endfunction
